<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<link rel="stylesheet" href="${pageContext.request.contextPath}/assets/js-lib/bootstrap-select/css/bootstrap-select.min.css">
<script src="${pageContext.request.contextPath}/assets/js-lib/bootstrap-select/bootstrap-select.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/js-lib/bootstrap-select/defaults-zh_CN.min.js"></script>

<div class="modal-header">
	<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
	<h4 class="modal-title" id="exampleModalLabel">
			${empty vo?'新增信息':'编辑信息'}
	</h4>
</div>
<form id="saveForm" class="form-horizontal" method="post"
	  action="${pageContext.request.contextPath}/sys/personal/save.do">
	<div class="modal-body" style="min-height:300px;height:auto;">
		<input type="hidden"  value="${vo.id}" name="id" id="id"/>

		<div class="row form-group">
			<div class="col-md-3 control-label">
				<label>真实名称</label>
			</div>
			<div class="col-md-6 controls">
				<input type="text" id="trueName" name="trueName" class="form-control inputStart" value="${vo.trueName}"/>
			</div>
		</div>

		<div class="row form-group">
			<div class="col-md-3 control-label">
				<label>原密码</label>
			</div>
			<div class="col-md-6 controls">
				<input type="password" id="oldPassWord" name="oldPassWord" class="form-control inputStart" value=""/>
			</div>
		</div>
		<div class="row form-group">
			<div class="col-md-3 control-label">
				<label>新密码</label>
			</div>
			<div class="col-md-6 controls">
				<input type="password" id="password" name="password" class="form-control inputStart" value=""/>
			</div>
		</div>
		<div class="row form-group">
			<div class="col-md-3 control-label">
				<label>确认密码</label>
			</div>
			<div class="col-md-6 controls">
				<input type="password" id="cofirmPwd" name="cofirmPwd" class="form-control inputStart" value=""/>
			</div>
		</div>
	<shiro:hasAnyRoles name="manager,teacher,admin">
		<div class="row form-group">
			<div class="col-md-3 control-label"></div>
			<div class="col-md-6 controls">
				<span style="color: #00B83F;">初始密码为：123456</span>
			</div>
		</div>
	</shiro:hasAnyRoles>
	</div>


	<div class="modal-footer">
		<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
		<button type="submit" class="btn btn-primary" id="submit-btn">确认</button>
	</div>
</form>

<script type="text/javascript"
		src="${pageContext.request.contextPath}/assets/js-lib/bootstrap-Validation/dist/js/bootstrapValidator.js" charset="UTF-8"></script>
<script type="text/javascript">


    $('#saveForm').bootstrapValidator({
        //        live: 'disabled',
        message: '值不合法',
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {

            trueName: {
				/* group : '.col-sm-4', */
                validators: {
                    notEmpty: {
                        message: '真实名称不能为空'
                    }
                }
            },
            oldPassWord: {
				/* group : '.col-sm-4', */
                validators: {
                    notEmpty: {
                        message: '原密码不能为空'
                    },
                    remote : {
                        type : 'POST',
                        message : '密码不正确',
                        url:'${pageContext.request.contextPath}/sys/personal/check.do?id=${vo.id}',
                        delay:500
                    }
                }
            },
            password: {
				/* group : '.col-sm-4', */
                validators: {
                    notEmpty: {
                        message: '新密码不能为空'
                    },
                    stringLength: {
                        min: 6,
                        max: 18,
                        message: '密码长度必须在6到18之间'
                    }
                }
            },
            cofirmPwd: {
                validators: {
                    notEmpty: {
                        message: '确认密码不能为空'
                    },
                    identical: {//相同
                        field: 'password',
                        message: '两次密码不一致'
                    }
                }
            }


        }
    });



</script>
